<html>
<head>
<title>Insert Smiley</title>
<link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
<script type="text/javascript" src="../../../popups/popup.js"></script>
<script type="text/javascript">
  window.resizeTo(400, 300);
var InsertSmiley = window.opener.InsertSmiley;
var editor = null;
var _editor_url = opener._editor_url;
var param;
var smileys = null;
function Init() {
  __dlg_translate("InsertSmiley");
  __dlg_init();
  param = window.dialogArguments;
  editor = param['editor'];
  var smileyList = Xinha._geturlcontent(_editor_url + 'plugins/InsertSmiley/smileys.txt');
  smileyList = smileyList.match(/^.+$/mg);
  var smileyURL = editor.config.InsertSmiley.smileyURL;
  var tbody = document.getElementById("smileytable");
  var inum;
  var trow;
  for(var i = 0; i < smileyList.length; i++) {
    if((i) % 4 == 0) {
      trow = tbody.insertRow((i ) / 4);
    }
   trow.insertCell((i) % 4).innerHTML = '<a onclick="onOK(\'' + encodeURIComponent( smileyList[i] ) + '\')" href="javascript:void(0);"><img style="border: 0px;" alt="Smiley ' + (i +1) + '" src="'+ smileyURL + encodeURIComponent(smileyList[i]) + '" />';
  }
}
function onCancel() {
  __dlg_close(null);
  return false;
}

function onOK(smileyfile) {
  var params = {};
  params.smileyfile = smileyfile;
  __dlg_close(params);
  return false;
}

</script>

<style type="text/css">
.buttons {border-top: 1px solid #999; padding: 5px; text-align: right; height: 20px; }
</style>
</head>
  <body class="dialog" onload="Init()">
<form action="" method="get">
  <div class="title" style="width: 360px;">Insert Smiley</div>
  <div style="height: 175px; overflow:auto;" align="center">
  <table style="border: 0; width: 370px;" id="smileytable">
  </table>
  </div>
<div class="space"></div>
<div class="buttons">
<button type="button" onclick="return onCancel();">Cancel</button>
</div>
<div id="showselect" style="position:absolute; left:7px; top:75px; width:150px; z-index:100; visibility: visible; height: 13px; color: red;">
</div>
</form>
</body>
</html>